'''
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with self work for additional information
 * regarding copyright ownership.  The ASF licenses self file
 * to you under the Apache License, Version 2.0 (the
 * "License") you may not use self file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http:#www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
'''
from base.graph.Node import Node

'''
 * RDF Graphs as RDF terms.
 * <p>
 * Beware that equality and hashCode are defined by
 * object identity, not graph same-triples nor isomorphism.
 * <p>
 * For experimentation.
 * Otherwise, unsupported.
'''
class Node_Graph(Node):

    # private final
    # Graph graph = None

    # param Graph graph:
    def __init__(self, graph):
        super().__init__(graph)
        self.graph = graph
    

    #@Override
    # param 
    # result boolean
    def isNodeGraph(self):
        return True
    

    #@Override
    # param 
    # result Graph
    def getGraph(self):
        return self.graph
    

    #@Override
    # param NodeVisitor v
    # result Object
    def visitWith(self, v):
        return v.visitGraph(self, self.graph)
    

    #@Override
    # param 
    # result int
    def hashCode(self):
        #return System.identityHashCode(self.getGraph()) * 31
        return hash(self.getGraph()) * 31
    

    #@Override
    # param Object o
    # result boolean
    def equals(self, o):
        if (o == self):
            return True
        if (not (isinstance(o, Node_Graph))):
            return False
        #Node_Graph other = (Node_Graph) o
        #return self.getGraph() == other.getGraph()
        return self.getGraph() == o.getGraph()
    

    #@Override
    # param 
    # result boolean
    def isConcrete(self):
        # Safe answer!
        return False
    

